home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 9229 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  2.1 KB

  1. Path: newshost.lanl.gov!tanmoy
  2. From: tanmoy@qcd.lanl.gov (Tanmoy Bhattacharya)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: C compiling question
  5. Date: 07 Mar 1996 15:19:47 GMT
  6. Organization: Los Alamos National Laboratory
  7. Message-ID: <TANMOY.96Mar7081947@qcd.lanl.gov>
  8. References: <3138D53F.41C6@mashie.ece.jhu.edu> <TANMOY.96Mar2225602@qcd.lanl.gov>
  9.     <313CF1CA.167E@mashie.ece.jhu.edu>
  10. NNTP-Posting-Host: qcd.lanl.gov
  11. Mime-Version: 1.0
  12. Content-Type: text
  13. In-reply-to: Chenyang Xu's message of Tue, 05 Mar 1996 21:00:42 -0500
  14.  
  15. In article <313CF1CA.167E@mashie.ece.jhu.edu>
  16. Chenyang Xu <chenyang@mashie.ece.jhu.edu> writes:
  17.  
  18. <snip>
  19. CX: You are saying that when compiler are compiling source file separately
  20. CX: into object codes, it will assume all the undeclared but called
  21. CX: functions as "extern int some_fun()", then at the linking stage, the
  22.  
  23. Actually, all the functions whose declarations are not known
  24. (technically `visible') at the point of their use are declared `extern
  25. int name();'. Note that extern does not mean that it has to be in a
  26. separate file: very commonly it is later in the same file.
  27.  
  28. CX: linker will try to find whether there is a function by that name, if
  29. CX: not, displaying error message, if yes, then proceed smoothly without
  30. CX: checking the consistency of the function return types.
  31.  
  32. Unfortunately, it puts this declaration in a block scope, which means
  33. when it finishes translating the current block, it forgets this
  34. declaration. So, even if the function is later defined in the same
  35. file with an incompatible definition (e.g. `char *name() {/* */}'),
  36. the compiler is not required to complain.
  37.  
  38. Cheers
  39. Tanmoy
  40. --
  41. tanmoy@qcd.lanl.gov(128.165.23.46) DECNET: BETA::"tanmoy@lanl.gov"(1.218=1242)
  42. Tanmoy Bhattacharya O:T-8(MS B285)LANL,NM87545 H:#9,3000,Trinity Drive,NM87544
  43. Others see <gopher://yaleinfo.yale.edu:7700/00/Internet-People/internet-mail>,
  44. <http://alpha.acast.nova.edu/cgi-bin/inmgq.pl>or<ftp://csd4.csd.uwm.edu/pub/
  45. internetwork-mail-guide>. -- <http://nqcd.lanl.gov/people/tanmoy/tanmoy.html>
  46. fax: 1 (505) 665 3003   voice: 1 (505) 665 4733    [ Home: 1 (505) 662 5596 ]
  47.